#ifndef MYSYNTAXHIGHLIGHTER_H
#define MYSYNTAXHIGHLIGHTER_H

#include <QSyntaxHighlighter>
#include <QTextDocument>
#include <QTextCursor>
#include <QTextBlock>

class MySyntaxHighlighter : public QSyntaxHighlighter
{
    Q_OBJECT

public:
    explicit MySyntaxHighlighter(QTextDocument* parent = nullptr);

protected:
    // 重新实现高亮(因为官方库 class QSyntaxHighlighter 里面的 virtual void highlightBlock(const QString &text) = 0; 纯虚函数是一个参数，所以子类重写的话，也得是一个参数的哦)
//    virtual void highlightBlock(const QString& text, QTextBlock block);
    virtual void highlightBlock(const QString& text);

private:
    QTextCursor textCursor;
    QTextBlock textBlock;
};

#endif // MYSYNTAXHIGHLIGHTER_H
